# -*- coding: utf-8 -*-
"""
@Time    : 2024/7/10 15:40 
@Author  : ZhangShenao 
@File    : 3.调用Text文本模型.py 
@Desc    : 调用Text文本模型
"""
import os

import dotenv
from langchain_core.prompts import PromptTemplate
from langchain_openai import OpenAI

dotenv.load_dotenv()
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate.from_template(template)
llm = OpenAI(model_name='gpt-3.5-turbo',
             openai_api_base=os.getenv('OPENAI_API_BASE'),
             temperature=0.6,
             max_tokens=60
             )
chain = prompt | llm
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"
response = chain.invoke(question)
print(response)
